package testclient;

import java.io.*;

public class ConsoleCommander {
	
	private BufferedReader br = null;
	private BlockingClient bc = null;
	
	public ConsoleCommander(){
		this.br = new BufferedReader(new InputStreamReader(System.in));
		this.bc = new BlockingClient("a");
	}
	
	public void active(){
		
		String line = null;
		while(true){
			System.out.println("\nInput Command >");
			try {
				line = this.br.readLine();
				
				if(line.equals("connect")){
					this.bc.open();
				} else if(line.equals("sendText")){
					this.bc.sendString("Ahehe");
				} else if(line.equals("exit")){
					break;
				} else if(line.equals("close")){
					this.bc.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			
		}
	}
	
	public static void main(String ... v){
		new ConsoleCommander().active();
	}
}
